package com.example.thridhero.waterfalltest;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {
    private List<Woman> womanList = new ArrayList<Woman>();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initWoman();
        RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);

        StaggeredGridLayoutManager staggeredGridLayoutManager = new
                StaggeredGridLayoutManager(2,StaggeredGridLayoutManager.VERTICAL);
        recyclerView.setLayoutManager(staggeredGridLayoutManager);
        WomanAdapter womanAdapter = new WomanAdapter(womanList);
        recyclerView.setAdapter(womanAdapter);
    }
    private void initWoman(){
        for (int i = 0 ;i < 2; i++){
            Woman apple = new Woman("AppleAppleAppleAppleAppleApple",R.mipmap.a);
            womanList.add(apple);

            Woman banana = new Woman("bananabananabananabananabananabanana",R.mipmap.b);
            womanList.add(banana);

            Woman orange = new Woman("orangeorangeorangeorange",R.mipmap.c);
            womanList.add(orange);

            Woman watermelon = new Woman("watermelonwatermelonwatermelonwatermelon",R.mipmap.d);
            womanList.add(watermelon);

            Woman pear = new Woman("pearpearpearpear",R.mipmap.e);
            womanList.add(pear);

            Woman grape = new Woman("grapegrapegrapegrape",R.mipmap.f);
            womanList.add(grape);

            Woman pineapple = new Woman("pineapplepineapplepineapple",R.mipmap.h);
            womanList.add(pineapple);

            Woman strawberry = new Woman("strawberrystrawberrystrawberrystrawberry",R.mipmap.i);
            womanList.add(strawberry);

            Woman cherry = new Woman("cherrycherry",R.mipmap.j);
            womanList.add(cherry);



        }
    }
}
